<template>
  <div class="select-button-group">
    <el-button
      v-for="(item, index) in list"
      :key="index"
      :type="item.type"
      @click="change(item, index)"
      >{{ item.businessName }}</el-button
    >
  </div>
</template>

<script>
export default {
  name: 'MmvSelectButton',
  props: {
    defaultType: {
      type: String,
      default() {
        return 'primary'
      },
    },
    disabled: {
      type: Boolean,
      default() {
        return false
      },
    },
    list: {
      type: Array,
      default() {
        return []
      },
    },
  },
  data() {
    return {}
  },
  methods: {
    change(item, index) {
      if (!this.disabled) {
        this.list.map((item, i) => {
          if (i === index) {
            item.type = this.defaultType
          } else {
            item.type = ''
          }
        })
      }
      this.$emit('change', item)
    },
  },
}
</script>
